package com.ruoyi.dataserver.controller;


import com.ruoyi.dataserver.model.REDLINE;
import com.ruoyi.dataserver.service.IRedLineService;
import com.ruoyi.dataserver.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @ProjectName
 * @Package com.lab.dataserver.controller
 * @ClassName RedLineController
 * @Description 红线审核
 * @Company lab
 * @Author wangzhx
 * @Date 2023/3/29  18:03
 * @UpdateUser
 * @UpdateDate
 * @UpdateRemark
 * @Version 1.0.0
 */
@RestController
@RequestMapping("/redLineController")
@Slf4j
public class RedLineController {

    @Autowired
    private IRedLineService redLineService;


    /**
     * @Title  红线数据添加接口
     * @Description
     * @return
     * @author wangw
     * @date 2023/3/29 10:57
     */
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public String add(@RequestBody REDLINE dto){
        String result = redLineService.add(dto);
        return result;
    }
    /**
     * @Title  红线数据删除接口
     * @Description
     * @return
     * @author wangw
     * @date 2023/3/29 10:57
     */
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    public String delete(@RequestBody Map map){
        String  id = map.get("id").toString();
        String result = redLineService.delete(id);
        return result;
    }

    /**
     * @Title  红线数据列表查询接口
     * @Description
     * @return
     * @author wangw
     * @date 2023/3/29 10:57
     */
    @RequestMapping(value = "/serach",method = RequestMethod.POST)
    public R serach(){
        List<REDLINE> list = redLineService.search();
        return R.ok(list);
    }
}
